package com.iyundao.io.mapper;

import com.iyundao.io.model.Integral;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Repository
public interface IntegralMapper {
    @Insert({
        "insert into integral (id, integralsum, ",
        "integralnow, partymemberid)",
        "values (#{id,jdbcType=INTEGER}, #{integralsum,jdbcType=INTEGER}, ",
        "#{integralnow,jdbcType=INTEGER}, #{partymemberid,jdbcType=INTEGER})"
    })
    int insert(Integral record);

    @InsertProvider(type=IntegralSqlProvider.class, method="insertSelective")
    int insertSelective(Integral record);

    @Update("update integral set integralsum=#(integralsum,jdbcType=INTEGER), integralmow=#{integralnow,jdbcType=INTEGER} where id=#{id,jdbcType=INTEGER}")
    int update(Integral integral);

    @Select("select id,integralsum,integralnow,partymemberid from integral where partymemberid=#{partymemberid,jdbcType=INTEGER}")
    Integral selectByPartyMemberId(Integer partymemberid);


}